// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   UserInfo.java

package include.users_lock;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.*;

public class UserInfo
	implements Serializable, HttpSessionBindingListener
{

	private String userName;

	public UserInfo(String uName)
	{
		userName = "";
		userName = uName;
	}

	public void valueBound(HttpSessionBindingEvent event)
	{
		HttpSession session = event.getSession();
		ServletContext ctx = session.getServletContext();
		Map map = (Map)ctx.getAttribute("user");
		if (map == null)
		{
			map = new HashMap();
			ctx.setAttribute("user", map);
		}
		if (!map.containsValue(userName))
			map.put(userName, userName);
	}

	public void valueUnbound(HttpSessionBindingEvent event)
	{
		HttpSession session = event.getSession();
		ServletContext ctx = session.getServletContext();
		Map map = (Map)ctx.getAttribute("user");
		map.remove(userName);
	}
}
